import {apiClient} from "@/utils/request";



// 用户跳转订单
export const saveOrderFun = () => {
    return apiClient({
      url: '/order/order-item/auth/trade',
      method: 'get',
    })
  };

// 根据订单id生成订单

export const getOrderByIdFun = (orderId:any) => {
  return apiClient({
    url: '/order/order-item/trade/byOrderId/'+orderId,
    method: 'get',
  })
};
// 根据skuId生成订单
export const getOrderBySkuIdFun = (skuId:any) => {
  return apiClient({
    url: '/order/order-item/trade/bySkuId/'+skuId,
    method: 'get',
  })
};
// 获取购物车中选中的商品

export const getOrderAllCartFun = () => {
  return apiClient({
    url: '/order/order-item/getAll/cart',
    method: 'get',
  })
};

export const createOrderFun = (data:any) => {
  return apiClient({
    url: '/order/order-item/create/order',
    method: 'post',
    data: data,
  })
};

// 获取订单列表
export const getAllPageOrderFun = (page:number,limit:number,data:string) => {
  return apiClient({
    url: '/order/order-info/getPageList/'+page+'/'+limit,
    method: 'get',
    params:{
      product: data
    }
  })
};


// 根据id删除订单
export const deleteByIdOrderFun = (id:number) => {
  return apiClient({
    url: '/order/order-info/deleteById/'+id,
    method: 'delete',
  
  })
};

// //修改订单状态


export const updateOrderType = (id:number) => {
  return apiClient({
    url: "/order/order-item/update/orderType/"+id,
    method: 'post',
  
  })
};
